package com.ljf.interestingmaps.adapter;

import android.content.Context;
import android.view.View;

import com.bumptech.glide.Glide;
import com.ljf.interestingmaps.R;
import com.ljf.interestingmaps.databinding.StreetItemBinding;
import com.ljf.interestingmaps.streetview.StreetViewBean;

public class PlaceAdapter extends BaseBindingAdapter<StreetViewBean, StreetItemBinding> {

    public PlaceAdapter(Context context) {
        super(context);
    }

    @Override
    protected int getLayoutResId(int viewType) {
        return R.layout.street_item;
    }

    @Override
    protected void onBindItem(StreetItemBinding binding, StreetViewBean item, final int position) {
        binding.setModel(item);
        Glide.with(context).load(item.getPic_Url()).into(binding.icon);
        binding.main.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (getOnRecyclerViewItemClickListener() != null)
                    getOnRecyclerViewItemClickListener().onItemClick(position);
            }
        });
    }
}
